/*************************************************************************
> File Name: 002.c
> Author: icebear
> Mail: 3322366195@qq.com
> Created Time: 2023-07-24 15:23:35
> Description: 用指针给一个数组赋值，并打印
************************************************************************/

#include <stdio.h>
void safeScanfInt(int *i);
int main(int argc, char const *argv[])
{
    int arr[10];
    printf("input 10 bumber\n");
    int *p = arr;
    for (int i = 0; i < 10; i++)
    {
        safeScanfInt((p + i));
    }
    printf("the arr is:");
    for (int i = 0; i < 10; i++)
    {
        printf("%d ", *(p + i));
    }
    printf("\n");
    return 0;
}

void safeScanfInt(int *i)
{
    scanf("%*[^0-9]");
    scanf("%d*[^\n]%*c", i);
}